﻿using Microsoft.VisualStudio.TestTools.UnitTesting;
using System;

[TestClass]
public class CourseTest
{
    [TestMethod]
    public void OverflowStudentTest()
    {
        Course c = new Course();
        for (int i = 0; i < 31; i++)
        {
            c.JoinCourse(10000 + i);
        }
        bool result = c.JoinCourse(10031);
        Assert.IsFalse(result);
    }

    [TestMethod]
    public void DuplicateStudentTest()
    {
        Course c = new Course();
        c.JoinCourse(10031);
        bool result = c.JoinCourse(10031);
        Assert.IsFalse(result);
    }

    [TestMethod]
    public void FillingTheCourse()
    {
        Course c = new Course();
        for (int i = 0; i < 35; i++)
        {
            c.JoinCourse(10000 + i);
        }
        Assert.AreEqual(30, c.StudentsCount);
    }

    [TestMethod]
    public void DeletingSingleStudent()
    {
        Course c = new Course();
        c.JoinCourse(99999);
        c.LeaveCourse(99999);
        Assert.AreEqual(0, c.StudentsCount);
    }

    [TestMethod]
    public void FillingAndClearingTheCourse()
    {
        Course c = new Course();
        for (int i = 0; i < 35; i++)
        {
            c.JoinCourse(10000 + i);
        }
        for (int i = 0; i < 35; i++)
        {
            c.LeaveCourse(10000 + i);
        }
        Assert.AreEqual(0, c.StudentsCount);
    }
}

